//
//  ViewController.m
//  07-UIViewController生命周期
//
//  Created by 402030900@qq.com on 16/7/22.
//  Copyright © 2016年 402030900@qq.com. All rights reserved.
//

#import "ViewController.h"
#import "SecondViewController.h"

@interface ViewController ()

@end

@implementation ViewController
#pragma mark -- life Cycle 生命周期
// loadView 和 viewDidLoad 直走一次
-(void)loadView{
    [super loadView];
    NSLog(@"%@-----%s",[self class],__FUNCTION__);
}
- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"%@-----%s",[self class],__FUNCTION__);
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:(UIBarButtonSystemItemAdd) target:self action:@selector(barButtonClicked:)];
    self.view.backgroundColor = [UIColor colorWithRed:0.989 green:1.000 blue:0.552 alpha:1.000];
  

    // Do any additional setup after loading the view, typically from a nib.
}
#pragma mark -- buttonClick
-(void)barButtonClicked:(UIBarButtonSystemItem *)barButton{
   SecondViewController  * second = [[SecondViewController alloc]init];
    [self.navigationController pushViewController:second animated:YES];
}
// 视图将要出现时就会调用
-(void)viewWillAppear:(BOOL)animated{
     [super viewWillAppear:animated];
    NSLog(@"%@-----%s",[self class],__FUNCTION__);


}
// 视图已经出现时,就会调用
-(void)viewDidAppear:(BOOL)animated{
     [super viewDidAppear:animated];
    NSLog(@"%@-----%s",[self class],__FUNCTION__);

}
// 视图将要消失,就会调用,只要有一点消失
-(void)viewWillDisappear:(BOOL)animated{

    [super viewWillDisappear:animated];
    NSLog(@"%@-----%s",[self class],__FUNCTION__);

}
// 视图完全消失,会调用
-(void)viewDidDisappear:(BOOL)animated{
     [super viewDidDisappear:animated];
    NSLog(@"%@-----%s",[self class],__FUNCTION__);

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
